//FACEBOOK ASYNC CLIENT

//FacebookAsyncUser methods

#include "facebookasync.h"

#include "xmlParser.h"
#include "md5.h"
#include <fstream>
#include <iostream>

//GENERIC CALL ROUTINES

bool FacebookAsyncUser::MakeGenericCall(FacebookGenericCallData& CallData)
{
	assert(m_CurLoginStage == LOGINSTAGE_SUCCEED);
	assert(m_CurInfoStage == INFOSTAGE_SUCCEED);
	assert(m_CurPhotoStage == PHOTOSTAGE_NOTSTARTED || m_CurPhotoStage == PHOTOSTAGE_FAILED || m_CurPhotoStage == PHOTOSTAGE_SUCCEED);
	
	assert(m_CurNotificationStage != NOTIFSTAGE_INPROGRESS);

	assert(m_CurPostFeedItemStage != POSTFEEDSTAGE_INPROGRESS); 

	assert(m_GenericCallInProgress != true);

	assert(m_HasActiveRequest == false);

	FacebookAsync::Instance().Helper_PrepareAPICallEx(CallData.m_Method, CallData.m_Params, CallData.m_NormalizedParams, this);

	PushNewRequest();

	m_GenericCallInProgress = true;

	return true;
}


void FacebookAsyncUser::OnGenericCallDone()
{

	assert(m_GenericCallInProgress == true);

	PullCompletedRequest();

	if (m_CurRequestResult.size() < 1)
	{
		FacebookAsync::Instance().SetErrorDescription("FacebookAsync::OnGenericCallDone(). Request failed!");
	}

	m_GenericCallInProgress = false;

}

